From ce2b03fb0b9315e1fa7a0f2dc2007521d1aaa572 Mon Sep 17 00:00:00 2001 From: physikerwelt Date: Fri, 3 Jan 2014 17:05:24 +0000 Subject: [PATCH] Add reference to the current user to the PageRenderingHash hook To generate a user-dependent cache key it makes sense to pass a reference to the user object, since $wgUser is deprecated. Change-Id: I32a1df52912292230852c31d69968eeb312a4a97 --- docs/hooks.txt | 3 ++- includes/parser/ParserOptions.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index fc4d40e3ae..fd434d46e4 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1793,7 +1793,8 @@ $queryInfo: the query parameters 'PageRenderingHash': Alter the parser cache option hash key. A parser extension which depends on user options should install this hook and append its values to the key. -$hash: reference to a hash key string which can be modified +&$confstr: reference to a hash key string which can be modified +$user: User (object) requesting the page 'ParserAfterParse': Called from Parser::parse() just after the call to Parser::internalParse() returns. diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 8393216875..c4e9a1ce9e 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -571,7 +571,7 @@ class ParserOptions { // Give a chance for extensions to modify the hash, if they have // extra options or other effects on the parser cache. - wfRunHooks( 'PageRenderingHash', array( &$confstr ) ); + wfRunHooks( 'PageRenderingHash', array( &$confstr, $this->getUser() ) ); // Make it a valid memcached key fragment $confstr = str_replace( ' ', '_', $confstr ); -- 2.20.1